<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1,minimum-scale=1, maximum-scale=1, user-scalable=no">
    <title>canvas</title>
    <style>
        * {
            moz-user-select: -moz-none;
            -moz-user-select: none;
            -o-user-select: none;
            -khtml-user-select: none;
            -webkit-user-select: none;
            -ms-user-select: none;
            user-select: none;
        }
    </style>
</head>
<body>
<br>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<div style="width: 500px;height: 500px;background: #3c3c3d;margin: 0 auto">
    <canvas id="canvas" style="border:1px solid red" >

    </canvas>
</div>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
</body>
</html>
<script src="js/jquery-3.3.1.min.js"></script>
<script>

        var cav = document.getElementById("canvas");
        var left=cav.getBoundingClientRect().left;
        var right=cav.getBoundingClientRect().right;
        var top=cav.getBoundingClientRect().top;
        var bottom=cav.getBoundingClientRect().bottom;
        console.log("left:"+left+" ;right:"+right+"; top:"+top+"; bottom:"+bottom)
        var cxt = cav.getContext("2d");
        cav.width=600;
        cav.height=600;


</script>